package com.newcoder.community.utill;
/**
 * 持有用户 信息，用于替代session
 */

import com.newcoder.community.pojo.User;
import org.springframework.stereotype.Component;

@Component
public class HostHolder {
    private ThreadLocal<User> users = new ThreadLocal<>();

    public User getUser() {
        return users.get();
    }

    public void setUsers(User user) {
        users.set(user);
    }

    public void clean() {
        users.remove();
    }
}
